The square laser maze
Consider a sample laser maze shown on the left below:
In maze 1, the orange laser beam starts from coordinates (1,2) with laser going along the
East direction. The laser first hits a single‐sided mirror at (2,2), and then travels North, hits a
double‐sided mirror at (2,4), and then goes East, hits another double‐sized mirror at (5,4),
and direction changes to South. Finally, arriving the destination at (5,3). The green laser
beam starts from (0,3) with laser going along the East direction. If you follow the path of the
laser beam, you will notice the laser hits a few mirrors and finally arriving the destination at
(4,1).
In maze 1, both laser beams arrive at a destination. On the other hand, all beams in maze 2
cannot reach a destination. The orange laser beam goes off the boundary, the green laser
beam is blocked at (2,5) and cannot go further, and the red laser beam is blocked at (3,0) as
well.
A typical laser maze contains these items:
At least 1 and at most 5 laser beam sources. Laser beam source will point to one of
these directions: North, East, South, West.
At least 1 and at most 5 destinations. Number of destinations can be different from
the number of sources.
Zero or more single‐sided mirrors. There are 4 kinds of single‐sided mirror, facing
NW, SE, SW, or NE.
Zero or more double‐sided mirrors. There are 2 kinds of double‐sided mirror.
Zero or more laser blocks. This is the cross shown in maze 2 above. A laser block will
stop any laser beam at the space that it is located.
Note that in a laser maze, there will be at most 20 items, and no two items share the same
coordinates. Smallest possible laser maze is 2x2.
x
y
0 1 2 3 4 5 6
6
5
4
3
2
1
0
Maze 1 Maze 2
ENGG1111 A1 2016/17
‐2‐
Converting the graphical maze into words
Somehow the laser maze needs to be entered into the program. We will give each item in
the laser maze a name. Below is the conversion table: